//
//  AXFHeaderController.m
//  AIXF
//
//  Created by mac on 2017/7/14.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "AXFHeaderController.h"
#import "NSAttributedString+Additon.h"
#import <SVProgressHUD.h>

@interface AXFHeaderController ()
    @property (weak, nonatomic) IBOutlet UITextField *text;
    @property(strong,nonatomic)UIAlertController *alert;
    @end

@implementation AXFHeaderController
    
    
- (instancetype)initWithFrame:(CGRect)frame
    {
        if (self = [super initWithFrame:frame])
        {
            
            self = [[NSBundle mainBundle] loadNibNamed:@"AXFHeaderController" owner:nil options:nil].lastObject;
            
        }
        return self;
    }
- (IBAction)chilckButton:(id)sender {
    
    
    if (_text.text.length ==0) {
        
//        self.alert=[UIAlertController alertControllerWithTitle:@"请输入优惠券" message:nil preferredStyle:UIAlertControllerStyleAlert];
        //确定action
        
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请输入优惠券" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [alert show];
        
//        UIAlertAction *sureAction=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//            
//        }];
//        [self.alert addAction:sureAction];
    
        
    }
    else{
        [SVProgressHUD showInfoWithStatus:@"请输入正确的优惠码"];
        [SVProgressHUD setInfoImage:[UIImage imageNamed:@"v2_title_bar_icon"]];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
        
    }
    
}
    
    @end
